@echo off
call setenv.bat
@echo Testing for JavaHome...
If "%JAVA_HOME%" == ""  goto javaHomeIsMissing
IF NOT EXIST "%JAVA_HOME%" goto javaHomeIsMissing

set CURRENT_DIR=%cd%
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%;%CURRENT_DIR%/lib/junit.jar;.;
set COMPILEJAVA=javac
set EXECUTEJAVA=java
set GENERATEJAR=jar
set OUTPUT_CLASS_OPTION=-d  ..\classes

IF NOT EXIST classes mkdir classes

cd src
echo Compiling Classes.....
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/vo/account/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/vo/bill/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/vo/common/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/vo/customer/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/vo/login/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/vo/subscription/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/vo/transaction/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/common/dataHandling/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/common/exception/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/common/validation/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/common/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/controller/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/dao/account/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/dao/bill/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/dao/customer/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/dao/login/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/dao/subscription/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/dummyData/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/exception/customer/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/exception/login/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/service/account/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/service/bill/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/service/customer/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/service/io/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/service/login/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/service/subscription/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/ui/controller/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/ui/gui/*.java
echo Compiling Source files Done.

cd ../test
set CLASSPATH=%CLASSPATH%;%CURRENT_DIR%/classes;	

echo Compiling Test Classes.....
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/dao/account/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/dao/bill/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/dao/customer/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/dao/login/*.java
%COMPILEJAVA%  %OUTPUT_CLASS_OPTION% -classpath "%CLASSPATH%" -Xlint:none sg/edu/nus/iss/billing/dao/subscription/*.java
echo Compiling Test Files Done.

echo Creating JAR file.....
cd ../classes
%GENERATEJAR% cf ../billingsystem.jar sg
echo Creating JAR file DONE.
cd %CURRENT_DIR% 



pause

:javaHomeIsMissing
echo JAVA HOME NOT AVAILABLE , Please set the JAVA_HOME in setenv.bat
:end	

system.consoloe.read()